package com.nbsaas.boot.product.rest.convert;

import com.nbsaas.boot.product.data.entity.Spec;
import com.nbsaas.boot.product.api.domain.simple.SpecSimple;

import com.nbsaas.boot.rest.api.Converter;

/**
* 规格-列表对象转换器
*/

public class SpecSimpleConvert implements Converter<SpecSimple, Spec> {




@Override
public SpecSimple convert(Spec source) {
    SpecSimple result = new SpecSimple();


                try {
                    if(source.getModel()!=null){
                        result.setModelName(source.getModel().getName());
                    }
                } catch (Exception ignored) { }

                result.setNote(source.getNote());
                result.setName(source.getName());

               try {
                   if(source.getModel()!=null){
                       result.setModel(source.getModel().getId());
                   }
                } catch (Exception ignored) { }

                result.setSortNum(source.getSortNum());
                result.setId(source.getId());
                result.setAddDate(source.getAddDate());
                result.setLastDate(source.getLastDate());


    return result;
}

}